package com.atguigu.guli.service.ucenter.controller.api;

import com.atguigu.guli.service.ucenter.properties.WxProperties;
import com.atguigu.guli.service.ucenter.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller

@RequestMapping("/api/ucenter/wx")
public class ApiWxLoginController {
    @Autowired
    WxProperties wxProperties;
    @Autowired
    MemberService memberService;

    //登录，返回登录二维码接口
    @GetMapping("login")
    public String wxlogin (HttpSession session){
        String url = memberService.wxLogin(session);
        return url;
    }
    //用户授权登录的回调接口
    @GetMapping("callback")
    public String callback(String code,String state,HttpSession session){
        String url = memberService.wxCallback(code,state,session);
        return url;
    }
}
